<extend name="public/base"/>
<block name="style">
</block>
<block name="body">
<div class="layui-card qn-header">
	<div class="layui-breadcrumb">
		<a href="">首页</a>
		<a href="{:U('index')}"><cite>前台导航管理</cite></a>
		<notempty name="pid">[&nbsp;父导航：<a href="{:U('index','pid='.$pid)}">{$parent.title}</a>&nbsp;]</notempty>
	</div>
</div>
<div class="layui-fluid">
	<div class="layui-card">
	<div class="layui-card-body">
		<div class="portlet-title">
			<div class="actions">
				<a class="layui-btn layui-btn-xs fbutton" href="{:U('add','pid='.$pid)}">新 增</a>
				<button class="layui-btn layui-btn-xs fbutton list_sort" url="{:U('sort',array('pid'=>I('get.pid',0)),'')}">排序</button>
			</div>
			<div class="clear"></div>
		</div>
		<div class="portlet-body">
		<div class="table-scrollable layui-form">
			<table class="layui-table" lay-even lay-skin="line">
				<thead>
				<tr>
				<th width="2%">
					<input type="checkbox" class="group-checkable" lay-skin="primary" lay-filter="allChoose">
				</th>
				<th>ID</th>
				<th>导航名称</th>
				<th>导航地址</th>
				<th>新窗口打开</th>
				<th>排序</th>
				<th>操作</th>
				</tr>
				</thead>
				<tbody>
					<volist name="list" id="channel">
					<tr>
						<td class="check">
						   <input class="ids" type="checkbox" name="ids[]" value="{$channel['id']}" lay-skin="primary" lay-filter="ids"/>
						</td>
						<td>{$channel.id}</td>
						<td><a href="{:U('index?pid='.$channel['id'])}">{$channel.title}</a></td>
						<td>{$channel.url}</td>
						   <th><eq name="channel.target" value="1">是<else/>不是</eq></th>
						   <td>{$channel.sort}</td>
						<td>
							<a href="{:U('setStatus?ids='.$channel['id'].'&status='.abs(1-$channel['status']))}" class="ajax-get layui-btn layui-btn-xs hbutton btn_see"><i class="layui-icon">&#x1006;</i> {$channel.status|show_status_op}</a>
							<a title="编辑" class="layui-btn layui-btn-xs hbutton btn_edit" href="{:U('edit?id='.$channel['id'].'&pid='.$pid)}"><i class="layui-icon">&#xe642;</i> 编辑</a>
							<a class="ajax-get layui-btn layui-btn-xs hbutton btn_trash" title="删除" href="{:U('del?id='.$channel['id'])}"><i class="layui-icon">&#xe640;</i> 删除</a>
						</td>
					</tr>
					</volist>
				</tbody>
			</table>
			</div>
		</div>
	</div>
</div>
</div>
</block>

<block name="script">
<script>
//点击排序
$('.list_sort').click(function(){
	var url = $(this).attr('url');
	var ids = $('.ids:checked');
	var param = '';
	if(ids.length > 0){
		var str = new Array();
		ids.each(function(){
			str.push($(this).val());
		});
		param = str.join(',');
	}

	if(url != undefined && url != ''){
		window.location.href = url + '/ids/' + param;
	}
});
</script>
</block>